package com.lmc.shuiyin;

import org.opencv.core.Size;

import static org.opencv.imgproc.Imgproc.FONT_HERSHEY_COMPLEX;
import static org.opencv.imgproc.Imgproc.getTextSize;

public class ShuiYinUtils {
    public static double getFontScale(Size maxSize, String watermark,int fontFace,int tickness){
        double fontScale=0.5;
        while (true){
            Size size =  getTextSize(watermark,fontFace,fontScale,tickness,null);
            if(size.height>=maxSize.height || size.width>= maxSize.width)
                break;
            fontScale=fontScale+0.2;
        }
        return fontScale;
    }
}
